package java_learn.java_jinjie.IO;

import java.io.File;

/**
 * @Author: 李浩然
 * @Date: 2020/12/29 12:06 下午
 */
public class Demo04File {
    public static void main(String[] args) {
//        show01();
        show02();
    }

    private static void show02() {
        File f1 = new File("/Users/lihaoran/Desktop/project/IdeaProjects/java-blockchain/java_learn/src/main/java/java_learn/java_jinjie/IO/a.txt");
        File f2 = new File("/Users/lihaoran/Desktop/project/IdeaProjects/java-blockchain/java_learn/src/main/java/java_learn/java_jinjie/IO");
        if (f1.exists()) {
            System.out.println(f1.isFile());
            System.out.println(f1.isDirectory());
        }
        if (f2.exists()) {
            System.out.println(f2.isFile());
            System.out.println(f2.isDirectory());
        }
    }

    /**
     * 用于判断路径是否存在
     */
    private static void show01() {
        File f1 = new File("/Users/lihaoran/Desktop/project/IdeaProjects/java-blockchain/java_learn/src/main/java/java_learn/java_jinjie/IO/a.txt");
        System.out.println(f1.exists());
    }
}
